package calbs.socket.analysis;

import calbs.socket.pojo.req.ReqData;
import calbs.socket.pojo.req.ReqGetSoftUpdateVersionMsg;

/**
 * Created by Q on 2017/8/3.
 */
public class GetSoftUpdateVersionAnalysisImp implements AnalysisI<ReqGetSoftUpdateVersionMsg> {
    @Override
    public ReqData<ReqGetSoftUpdateVersionMsg> analysisMsg(ReqData<ReqGetSoftUpdateVersionMsg> reqData){
        ReqGetSoftUpdateVersionMsg reqGetSoftUpdateVersionMsg = reqData.getBody();
        String content = reqGetSoftUpdateVersionMsg.getContent();
        Integer device = Integer.parseInt(content.substring(0,2*4),16);
        reqGetSoftUpdateVersionMsg.setDevice(device.toString());
        content = content.substring(2*4);
        Integer utcTime = Integer.parseInt(content.substring(0,2*4),16);
        reqGetSoftUpdateVersionMsg.setUtcTime(utcTime.toString());
        return reqData;
    }
}
